package br.ucb.sigplan.crud;

import java.util.List;

import br.ucb.sigplan.beans.PlanoEnsino;
import br.ucb.sigplan.beans.Turma;
import br.ucb.sigplan.dao.PlanoEnsinoDAO;
import br.ucb.sigplan.dao.impl.PlanoEnsinoDAOImpl;
import br.ucb.sigplan.exception.DAOException;

public class PlanoEnsinoCrud {
	private static PlanoEnsinoDAO planoEnsinoDAO;
	
	private PlanoEnsinoCrud() {
		
	}
	
	public static PlanoEnsinoDAO getPlanoEnsinoDAO() {
		if (planoEnsinoDAO == null) {
			planoEnsinoDAO = new PlanoEnsinoDAOImpl();
		}
		return planoEnsinoDAO;
	}
	
	public static void insert(PlanoEnsino planoEnsino) throws DAOException{
		getPlanoEnsinoDAO().insert(planoEnsino);
	}
	
	public static List<PlanoEnsino> findAll(){
		return getPlanoEnsinoDAO().findAll();
	}
	
	public static PlanoEnsino findPlanoEnsinoById(Integer idensinoPlano){
		return getPlanoEnsinoDAO().findPlanoEnsinoById(idensinoPlano);
	}
	
	public static void updatePlanoById(PlanoEnsino plano) throws DAOException{
		getPlanoEnsinoDAO().updatePlanoById(plano);
	}
	
	public static PlanoEnsino findByTurma(Turma turma){
		return getPlanoEnsinoDAO().findByTurma(turma);
	}
	
	public static void delete(Integer idplano) throws DAOException{
		getPlanoEnsinoDAO().delete(idplano); 
	}
}
